<template>
  <el-select filterable clearable v-bind="$attrs" style="width: 100%">
    <el-option
      v-for="item in options"
      :key="item[valueField]"
      :label="item[labelField]"
      :value="item[valueField]"
    />
  </el-select>
</template>

<script lang="ts" setup>
import { withDefaults } from 'vue'

interface Props {
  options: Array<Record<string, any>>
  labelField: string
  valueField: string
}

withDefaults(defineProps<Props>(), {
  options: () => [],
  labelField: 'label',
  valueField: 'value'
})
</script>

<style lang="scss" scoped></style>
